
package org.linlinjava.litemall.wx.web;

import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.core.validator.Order;
import org.linlinjava.litemall.core.validator.Sort;
import org.linlinjava.litemall.db.domain.LitemallIssue;
import org.linlinjava.litemall.db.service.LitemallIssueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/wx/issue")
@Validated
public class WxIssueController {

	@Autowired
	private LitemallIssueService issueService;

	/**
	 * 帮助中心
	 */
	@RequestMapping("/list")
	public Object list(String question,
		@RequestParam(defaultValue="1") Integer page,
		@RequestParam(defaultValue="10") Integer size,
		@Sort @RequestParam(defaultValue="add_time") String sort,
		@Order @RequestParam(defaultValue="desc") String order) {
		List<LitemallIssue> issueList = issueService.querySelective(question, page, size, sort, order);
		return ResponseUtil.okList(issueList);
	}
}